package innerclass;

public class Parcel5 {
    public Destination destination(String s){//在方法和作用域的内部类
        class PDestination implements Destination{
            private String label;
           private PDestination(String s1){
               label=s1;
           }
            @Override
            public String readLabel() {
                return label;
            }
        }

        return new PDestination(s);
    }

    public static void main(String[] args) {
        Parcel5 p=new Parcel5();
        Destination destination=p.destination("Zcb");//内部类向上转型
        System.out.println(destination.readLabel());
    }
}
